In the current source, it is difficult to see when the disable button
should be shown or not. This commit adjusts this and moves the handling
to an if else statement, so that it can be easily seen.
Signed-off-by: Florian Eckert <[email protected]>
]);
}
- btn1.disabled = isReadonlyView || btn1.classList.contains('spinning') || btn2.classList.contains('spinning') || dynamic;
- btn2.disabled = isReadonlyView || btn1.classList.contains('spinning') || btn2.classList.contains('spinning') || dynamic || disabled;
+ if (isReadonlyView === true) {
+ btn1.disabled = true;
+ btn2.disabled = true;
+ }
+ else if (btn1.classList.contains('spinning') || btn2.classList.contains('spinning')) {
+ btn1.disabled = true;
+ btn2.disabled = true;
+ }
+ else if (dynamic === true) {
+ btn1.disabled = true;
+ btn2.disabled = true;
+ }
+ else if (disabled === true) {
+ btn1.disabled = false;
+ btn2.disabled = true;
+ }
+ else {
+ btn1.disabled = false;
+ btn2.disabled = false;
+ }
}
document.querySelectorAll('.port-status-device[data-device]').forEach(function(node) {